#include <ConnectionBroker/clientconnection/WebSocketClientConnection.h>
#include <ConnectionBroker/PacketUtils.h>
#include <ConnectionBroker/server/WebSocketServer.h>
#include <websocketpp.hpp>
#include <json/json.h>

using namespace ConnectionBroker;

WebSocketClientConnection::WebSocketClientConnection(const connection_ptr pConnection)
: ClientConnection(), mConnection(pConnection)
{
}

WebSocketClientConnection::~WebSocketClientConnection()
{
}

void WebSocketClientConnection::write(const Packet& pPacket)
{
   //Convert json message to a string.
   std::string msg(PacketUtils::packetToString(pPacket));

   //Send the message.
   mConnection->send(msg);
}

